﻿@page "/pivot-table/advance-filtering"

@using Syncfusion.Blazor.PivotView
@using BlazorDemos
@using ej2_blazor_productdetails

<div class="control-section">
    <div class="content-wrapper">
        <SfPivotView Width="100%" TValue="PivotProductDetails" Height="400" ShowFieldList=true ShowGroupingBar=true EnableValueSorting=true ShowTooltip=false>
            <PivotViewDataSourceSettings DataSource="@data" ExpandAll=false EnableSorting=true AllowLabelFilter=true AllowValueFilter=true>
                <PivotViewColumns>
                    <PivotViewColumn Name="Year"></PivotViewColumn>
                    <PivotViewColumn Name="Order_Source"></PivotViewColumn>
                </PivotViewColumns>
                <PivotViewRows>
                    <PivotViewRow Name="Country"></PivotViewRow>
                    <PivotViewRow Name="Products"></PivotViewRow>
                </PivotViewRows>
                <PivotViewValues>
                    <PivotViewValue Name="In_Stock" Caption="In Stock"></PivotViewValue>
                    <PivotViewValue Name="Sold" Caption="Units Sold"></PivotViewValue>
                    <PivotViewValue Name="Amount" Caption="Sold Amount"></PivotViewValue>
                </PivotViewValues>
                <PivotViewFilters>
                    <PivotViewFilter Name="Product_Categories" Caption="Product Categories"></PivotViewFilter>
                </PivotViewFilters>
                <PivotViewFormatSettings>
                    <PivotViewFormatSetting Name="Amount" Format="C" UseGrouping=true></PivotViewFormatSetting>
                </PivotViewFormatSettings>
                <PivotViewDrilledMembers>
                    <PivotViewDrilledMember Name="Country" Items="@(new string[] { "France" })"></PivotViewDrilledMember>
                </PivotViewDrilledMembers>
                <PivotViewFilterSettings>
                    <PivotViewFilterSetting Name="Year" Type=Syncfusion.Blazor.PivotView.FilterType.Label Condition=Operators.Equals Value1="FY 2017"></PivotViewFilterSetting>
                </PivotViewFilterSettings>
            </PivotViewDataSourceSettings>
            <PivotViewGridSettings ColumnWidth="140"></PivotViewGridSettings>
        </SfPivotView>
    </div>
</div>

<style>
    .e-pivotview {
        min-height: 200px;
    }

    html, body {
        height: 100%;
    }
</style>

@code{

    public List<PivotProductDetails> data { get; set; }

    protected override void OnInitialized()
    {
        this.data = PivotProductDetails.GetProductData();
    }

}